package utils

import (
	"fmt"
	"testing"
)

func TestIsDir(t *testing.T) {
	type args struct {
		path string
	}
	tests := []struct {
		name string
		args args
		want bool
	}{
		{
			name: "1",
			args: args{
				path: "/tmp/test/b",
			},
			want: true,
		},
		{
			name: "2",
			args: args{
				path: "/tmp/test/b",
			},
			want: false,
		},
		{
			name: "3",
			args: args{
				path: "/tmp/test/a",
			},
			want: true,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := IsDir(tt.args.path); got != tt.want {
				t.Errorf("IsDir() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestListDir(t *testing.T) {
	p := "/tmp/test/b"

	ds := ListDir(false, p)
	t.Errorf("%v", p)
	for _, v := range ds {
		// info,e := v.Info()
		// info.
		fmt.Printf("%v,%v", v.IsDir(), v.Name())
		t.Errorf("%v,%v", v.IsDir(), v.Name())
	}
	fmt.Println("")
}
